#include "UI.h"
#include "Net/TcpServer.h"
#include "Log/Log.h"

std::string UIProcessor::Process(const char* buf, int iLen)
{
    zlog.UInfo("%s in, buf [%s]\n", __PRETTY_FUNCTION__, buf);
    return "ui_test";
}

std::string LibLogProcessor::Process(const char* buf, int iLen)
{
    std::string strBuf = buf;
    if (strBuf.find('\n') == std::string::npos)
    {
        log.append(buf);
        return "";
    }

    log.append(strBuf.substr(0, strBuf.find('\n')));
    if (m_strHeader.empty())
    {
        zlog.SInfo("%s\n", log.c_str());
    }
    else
    {
        zlog.SInfo("%s %s\n", m_strHeader.c_str(), log.c_str());
    }
    log.clear();

    if (strBuf.find('\n') + 1 < strBuf.size())
    {
        log = strBuf.substr(strBuf.find('\n') + 1);
    }
    return "";
}
